<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">
    <title>Form Layouts</title>
    <?php $this->load->view('library/header');?>
</head>
<body  class="sticky-header">
<style>
    .mtop10{
        margin-left: 47px;
        margin-right: 15px;
    }
    .yuanyin{
        width: 68%;
        margin: 0 auto;
    }
    .fz1{
        margin-top: 115px;
    }
    .fz3{
        width: 140px !important;
    }
    .fz2{
        display: flex;
    }
</style>
<section>
    <?php $this->load->view('library/left');?>
    <div class="main-content" >
        <div class="zhezhao"></div>
        <?php $this->load->view('library/top');?>
        <div class="page-heading">
            <h3>补充列表</h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Forms</a>
                </li>
                <li class="active"> Forms Layouts </li>
            </ul>
        </div>
<section class="wrapper">
    <section class="panel">
        <header class="panel-heading custom-tab turquoise-tab">
            <ul class="nav nav-tabs">
                <li class="">
                    <a href="<?php echo base_url('PrepareGoods/index_accurate?prepare_state=1');?>" >待审核</a>
                </li>
                <li class="active">
                    <!-- <a href="<?php echo base_url('PrepareGoods/index_accurate?prepare_state=2');?>" >待补充 (<?php echo $count;?>)</a> -->
                </li>
                <li class="">
                    <a href="<?php echo base_url('PrepareGoods/index_accurate?prepare_state=3');?>" >待编辑</a>
                </li>
                <li class="">
                    <a href="<?php echo base_url('PrepareGoods/index_accurate?prepare_state=4');?>" >上架审核</a>
                </li>

                <li class="">
                    <a href="<?php echo base_url('PrepareGoods/index_accurate?prepare_state=5');?>" >上架完成</a>
                </li>
                <li class="">
                    <a href="<?php echo base_url('PrepareGoods/index_accurate?prepare_state=6');?>" >回收站</a>
                </li>
            </ul>
        </header>
        <div class="panel-body">
            <div class="tab-content">
                <div class="tab-pane active" id="whole">
                    <?php $this->load->view('library/search');?>
                <section class="panel">
                        <div class="panel-body">
                            <div class="adv-table">
                                <table class="display table table-bordered table-striped" id="dynamic-table">
                                    <tr>
                                        <th width="3%">编号</th>
                                        <th width="5%">商品图片</th>
                                        <th width="10%">货号</th>
                                        <th width="5%" class="hidden-phone">开发员</th>
                                        <th width="6%" class="hidden-phone">商品分类</th>
                                        <th width="5%" class="hidden-phone">生产方式</th>
                                        <th width="5%" class="hidden-phone">渠道</th>
                                        <!-- <th width="5%" class="hidden-phone">备注</th> -->
                                        <th width="10%" class="hidden-phone">添加时间</th>
                                        <th width="5%" class="hidden-phone">操作</th>
                                    </tr>
                                    <?php foreach($prepare_accurate_list as $k=>$item){?>
                                        <tr class="gradeX">
                                            <td>
                                            <label>
                                                <input  name="goods_ids[]" type="checkbox"/><?php echo $item['prepare_id']?>
                                            </label>
                                            </td>

                                            <td>
                                                <img style="width: 100px;" class="img" src="<?php echo $item['original_img'];?>" />
                                            </td>

                                            <td>
                                                货号:<?php echo $item['goods_sn'];?>
                                                <div style="background-color: rgba(48, 10, 255, 0.98);width: 65px;margin-top: 30px;">
                                                    <span style="margin-left: 11px;color: aliceblue;">待补充</span>
                                                </div>
                                            </td>
                                            <td class="center hidden-phone">
                                                <?php echo $item['admin_name'];?>
                                            </td>
                                            <td class="hidden-phone">
                                                <?php echo $item['cate_name']?>
                                            </td>
                                            <td class="center hidden-phone">
                                                <?php echo $item['production_id'] == 1?'采买': '定制';?>
                                                
                                            </td>
                                            <td class="center hidden-phone">
                                                <?php echo $item['channel_id']?>
                                            </td>
                                            <td class="center hidden-phone"><?php echo $item['add_time'];?></td>
                                            <td class="hidden-phone">
                                                <a class="btn btn-xs btn-info examine log" data-id="<?php echo $item['prepare_id']?>" href="#rizhi" data-toggle="modal">操作日志</a><br>
                                                <a class="btn btn-xs btn-info" href="<?php echo 
                                                base_url("PrepareGoods/set/prepare_id/".$item['prepare_id'].'/'.'step/2');?>">编辑</a><br>
                                                <!-- <a class="btn btn-xs btn-info"  href="#huishou" data-toggle="modal">回收</a> -->
                                                <a class="btn btn-xs btn-info recovery" data-id="<?php echo $item['prepare_id']?>"  href="#huishou" data-toggle="modal">回收</a>
                                                <!-- <a class="btn btn-xs btn-info" href="">删除</a> -->
                                            </td>
                                        </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                            <div>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="dataTables_paginate paging_bootstrap pagination">
                                        <ul>
                                            <?php echo $pages;?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
                <!--操作日志弹窗-->
                <div class="modal fade" id="rizhi" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header"><h4 class="modal-title">操作日志</h4></div>
                            <div class="modal-body row log_show">
                                
                            </div>
                        </div>
                    </div>
                </div>
                <!--回收弹窗-->
                <div class="modal fade" id="huishou" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header"><h4 class="modal-title">回收</h4></div>
                            <div class="modal-body row fz2">
                                <div class="col-md-5 img-modal">
                                    <img style="width: 200px;" class="h_img fz3" src="" alt="">
                                </div>

                                <div class="form-group zidiyi yuanyin">
                                    <p class="liyou">回收原因:</p>
                                    <div id="" class="">
                                        <input name="reason_reason"   class="form-control" />
                                    </div>
                                </div>
                                <input type="hidden" name="examine_goods_id" >
                                <div class="pull-right"><button class="btn btn-success btn-sm recovery_sure fz1" type="button">确定</button></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</section>
        <footer>
            2014 &copy; AdminEx by
        </footer>
    </div>
</section>
<?php $this->load->view('library/footer');?>
</body>
</html>
<script src="/public/js/scripts.js"></script>
<script>
    $('.log').click(function(){
        var id = $(this).data('id');
        $.ajax({
            type:'post',
            url:"<?php echo base_url('PrepareGoods/select_log')?>",
            dataType:'json',
            data:{
                id:id
            },
            success:function(obj){
                var h = '';
                $.each(obj,function(i,n){
                   h += "<p class='mtop10'>"+n.add_time+" 【"+n.admin_id+"】 "+n.examine_type+"</p>";
                })
                $('.log_show').html(h);
            }
        })
    })

    //回收赋值
    $('.recovery').click(function(){
        var goods_id = $(this).data('id');
        var img = $('.img').attr('src');
        $('.h_img').attr('src',img)
        $("input[name='examine_goods_id']").val(goods_id);
    })
    //回收
    $('.recovery_sure').click(function(){
        var reason_reason = $("input[name='reason_reason']").val();
        var goods_id = $("input[name='examine_goods_id']").val();
        $.ajax({
            type:'post',
            url:"<?php echo base_url('PrepareGoods/recovery')?>",
            data:{
                goods_id:goods_id,
                reason_reason:reason_reason,
            },
        success:function(msg){
            if(msg){
                    location.reload();
                }
        }
        })
    })
</script>
